<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <blockquote class="layui-elem-quote">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input class="layui-input searchval" type="text" placeholder="请输入搜索的内容">
                    </div>
                    <button class="layui-btn" id="search_btn" data-type="reload">搜索</button>
                </div>
<%--                <shiro:hasPermission name="rfid:pro:hairpin">--%>
<%--                    <div class="layui-inline" style="float: right;position: relative;">--%>
<%--                        <div class="layui-form-item" style="margin-bottom: 0px;">--%>
<%--                            <label class="layui-form-label" style="width: 20px;">IP</label>--%>
<%--                            <div class="layui-input-inline" style="width: 50px;margin:0px">--%>
<%--                                <input type="text" id="ip1" autocomplete="off" class="layui-input"--%>
<%--                                       style="border: none;border-bottom: 1px solid #D2D2D2;" maxlength="3"--%>
<%--                                       oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">--%>
<%--                            </div>--%>
<%--                            <div class="layui-form-mid"--%>
<%--                                 style="margin:0px;background-color: #fff;border-radius:2px;padding-top:18px !important;padding-bottom: 0px !important">--%>
<%--                                .--%>
<%--                            </div>--%>
<%--                            <div class="layui-input-inline" style="width: 50px;margin:0px">--%>
<%--                                <input type="text" id="ip2" autocomplete="off" class="layui-input"--%>
<%--                                       style="border: none;border-bottom: 1px solid #D2D2D2;" maxlength="3"--%>
<%--                                       oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">--%>
<%--                            </div>--%>
<%--                            <div class="layui-form-mid"--%>
<%--                                 style="margin:0px;background-color: #fff;border-radius:2px;padding-top:18px !important;padding-bottom: 0px !important">--%>
<%--                                .--%>
<%--                            </div>--%>
<%--                            <div class="layui-input-inline" style="width: 50px;margin:0px">--%>
<%--                                <input type="text" id="ip3" autocomplete="off" class="layui-input"--%>
<%--                                       style="border: none;border-bottom: 1px solid #D2D2D2;" maxlength="3"--%>
<%--                                       oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">--%>
<%--                            </div>--%>
<%--                            <div class="layui-form-mid"--%>
<%--                                 style="margin:0px;background-color: #fff;border-radius:2px;padding-top:18px !important;padding-bottom: 0px !important">--%>
<%--                                .--%>
<%--                            </div>--%>
<%--                            <div class="layui-input-inline" style="width: 50px;margin:0px;">--%>
<%--                                <input type="text" id="ip4" autocomplete="off" class="layui-input"--%>
<%--                                       style="border: none;margin:0px;border-bottom: 1px solid #D2D2D2;" maxlength="3"--%>
<%--                                       oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">--%>
<%--                            </div>--%>
<%--                        </div>--%>
<%--                    </div>--%>
<%--                    <div class="layui-inline" style="float: right;position: relative;">--%>
<%--                        <label class="layui-form-label">端口号</label>--%>
<%--                        <input class="layui-input" id="post" type="text"--%>
<%--                               style="width: 50px;border: none;border-bottom: 1px solid #D2D2D2;" maxlength="4"--%>
<%--                               oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">--%>
<%--                    </div>--%>
<%--                </shiro:hasPermission>--%>
            </blockquote>
            <table class="layui-hide" id="product" lay-filter="products"></table>
            <div id="laypage"></div>

        </div>
    </div>
</div>
<input type="hidden" id="curnum" value="1">
<script type="text/html" id="control">
    <shiro:hasPermission name="rfid:pro:add">
        <div class="layui-inline" lay-event="add" title="添加">
            <i class="layui-icon layui-icon-add-1"></i>
        </div>
    </shiro:hasPermission>
    <shiro:hasPermission name="rfid:pro:batchadd">
        <div class="layui-inline" lay-event="batchadd" title="批量添加" id="batchadds">
            <i class="import">&#xe65a;</i>
        </div>
    </shiro:hasPermission>
</script>
<script type="text/html" id="operation">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="info">详情</a>
<%--    <shiro:hasPermission name="rfid:pro:hairpin">--%>
<%--        <a class="layui-btn layui-btn-xs" lay-event="hairpin">发卡</a>--%>
<%--    </shiro:hasPermission>--%>
    <shiro:hasPermission name="rfid:pro:update">
        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="update">修改</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="rfid:pro:del">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </shiro:hasPermission>
</script>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<input type="hidden" id="successes"/>
<%--从excel导入的数据--%>
<input type="hidden" id="datas"/>
<%--从验证的错误数据--%>
<input type="hidden" id="correctlenght"/>
<input type="hidden" id="correctdata"/>
<input type="hidden" id="correctsuccesses"/>
<input type="hidden" id="yyy"/>
<script type="text/html" id="importlistDemo">
    <div class="layui-inline" title="校验" lay-event="check">
        <i class="layui-icon layui-icon-add-1"></i>
    </div>
</script>
<script type="text/html" id="importlistDemos">
    <div class="layui-inline" lay-event="importdatas" title="导入" id="importdatas">
        <i class="layui-icon layui-icon-add-1"></i>
    </div>
</script>
<script>
    layui.use(['table', 'product', 'upload'], function () {
        var $ = layui.jquery,
            table = layui.table,
            layer = layui.layer,
            element = layui.element,
            upload = layui.upload;

        //搜索事件
        var active = {
            reload: function () {
                var searchval = $('.searchval').val();
                $("#curnum").val("1")
                table.reload('product', { //表格的id
                    where: {
                        key: searchval,
                        page: 1,
                        limit: 10,
                    },
                    text: {
                        none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                    }
                })
            }
        };
        $('#search_btn').on('click', function () { //搜索的id
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        //监听头工具栏事件
        table.on('toolbar(products)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
                , data = checkStatus.data;//获取选中的数据
            switch (obj.event) {
                case 'add':
                    add();
                    break;
                case 'update':
                    update(data);
                    break;
                case 'delete':
                    deletes(data);
                    break;
                case 'batchadd':
                    batchadd();
                    break;
            }
            ;
        });

        function add() {
            var clocess = "1";
            layer.open({
                title: "添加信息",
                type: 2,
                content: '<%=request.getContextPath()%>/rest/getRoute?type=rfid&url=product_add',
                area: ['90%', '91%'],
                maxmin: true,
                shade: 0.6,
                anim: 4,
                skin: 'layui-layer-molv',
                resize: true,
                cancel: function (index, layero) {
                    layer.close(index)
                    clocess = "2"
                    return false;
                },
                end: function () {
                    if (clocess == "2") {

                    } else {
                        table.reload('product')
                    }
                    return false;
                }

            });
        }

        function batchadd() {
            var url = '<ul class="layui-table-tool-panel">' +
                ' <li data-type="csv"><a href="javascript:;" onclick="dataTemplate()"><cite>导出数据模板</cite></a></li>' +
                ' <li data-type="xls"><a href="javascript:;" onclick="importExcel()"><cite>导入Excel文件</cite></a></li>' +
                ' <li data-type="image"><a href="javascript:;" onclick="image()"><cite>批量导入图片</cite></a></li>' +
                ' </ul>';
            $("#batchadds").append(url)
        }

        window.dataTemplate = function () {
            $(".layui-table-tool-panel").remove();
            var url = "<%=request.getContextPath()%>/rest/reporting/dataTemplateExcel?&typename=数据模板";
            window.open(url);
        }

        window.image = function () {
            $(".layui-table-tool-panel").remove();
            layui.layer.open({
                title: '批量图片上传'
                , type: 2
                , skin: 'layui-layer-molv'
                , resize: true
                , shade: 0.6
                , anim: 4
                , fix: false
                , area: ['90%', '91%']
                , content: '<%=request.getContextPath()%>/rest/getRoute?type=rfid&url=product_image',
            })
            ;
        }

        window.importExcel = function () {
            $(".layui-table-tool-panel").remove();
            var indexss = layui.layer.open({
                title: '选择excel文件'
                , type: 1
                , skin: 'layui-layer-molv'
                , resize: true
                , shade: 0.6
                , fix: false
                , area: ['40%']
                , content: '<div class="layui-col-md12" style="padding: 10px;">' +
                    '        <div class="layui-card">' +
                    '          <div class="layui-card-body" style="padding:30px 15px;">' +
                    '            <div class="layui-upload">' +
                    '              <button type="button" class="layui-btn layui-btn-normal" id="test-upload-change">选择excel文件</button>' +
                    '              <button type="button" class="layui-btn" id="test-upload-change-action" style="float: right">开始上传</button>' +
                    '            </div>' +
                    '          </div>' +
                    '        </div>' +
                    '      </div>'
            });
            var sss;
            upload.render({
                elem: '#test-upload-change'
                , url: '<%=request.getContextPath()%>/rest/reporting/importExcelFirst'
                , auto: false
                , accept: 'file'
                , bindAction: '#test-upload-change-action'
                , before: function (obj) {
                    layui.layer.close(indexss);
                    sss = layui.layer.msg('文件上传中', {
                        icon: 16
                        , shade: 0.6
                        , time: 10 * 1000
                    });
                },
                done: function (res, index, upload) {
                    if (res) {
                        setTimeout(function () {
                            layui.layer.closeAll();
                            if (res.msg == "success") {
                                var jsArr = JSON.stringify(res);
                                $("#datas").val(jsArr);
                                var sss = '<div class="layui-fluid">' +
                                    '<div class="layui-card">' +
                                    '<div class="layui-card-body">' +
                                    '<table class="layui-hide" id="importlist" lay-filter="importlists" ></table><hr>' +
                                    '<div class="layui-col-md1" style="color: #ff5722;margin-right:20px; " id="error"></div>' +
                                    '<div class="layui-col-md1" id="correct"></div>' +
                                    '<div class="layui-col-md2"  style="color: #ff5722;margin-right:20px; " id="correctyyyyy"></div>' +
                                    '</div>' +
                                    '</div>' +
                                    '</div>'

                                $("#correctsuccesses").val("1");
                                layui.layer.open({
                                    title: "导入数据验证",
                                    type: 1,
                                    area: ['90%', '91%'],
                                    content: sss,
                                    shade: 0.6,
                                    anim: 4,
                                    skin: 'layui-layer-molv',
                                    resize: true,
                                    success: function (layero, index) {  //当你需要在层创建完毕时即执行一些语句，可以通过该回调 想相当于吧值转到子界面
                                        layui.table.render({
                                            elem: '#importlist'
                                            , cellMinWidth: 200 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                                            , cols: [[
                                                {field: 'number', title: 'ID', width: 70, sort: true, fixed: "left"}
                                                , {field: 'assetNumber', title: '资产编号', fixed: "left"}
                                                , {field: 'auditStatus', title: '审核状态'}
                                                , {field: 'preparationTime', title: '制单时间'}
                                                , {field: 'auditOpinion', title: '审核意见'}
                                                , {field: 'category', title: '资产大类'}
                                                , {field: 'classify', title: '资产分类'}
                                                , {field: 'name', title: '物资名称'}
                                                , {field: 'accountSet', title: '帐套'}
                                                , {field: 'putIntoUseDate', title: '投入使用日期'}
                                                , {field: 'buildDate', title: '取得日期'}
                                                , {field: 'selfUseValue', title: '自用价值'}
                                                , {field: 'depreciationStatus', title: '折旧状态'}
                                                , {field: 'depreciationMonths', title: '已提折旧月数'}
                                                , {field: 'depreciationAccumulated', title: '累计折旧'}
                                                , {field: 'serviceLife', title: '使用年限（月）'}
                                                , {field: 'entryDate', title: '财务入账日期'}
                                                , {field: 'valueType', title: '价值类型'}
                                                , {field: 'value', title: '价值'}
                                                , {field: 'financialFunds', title: '财政性资金'}
                                                , {field: 'nonFinancialFunds', title: '非财政性资金'}
                                                , {field: 'netWorth', title: '净值'}
                                                , {field: 'carNumber', title: '车牌号'}
                                                , {field: 'engineNumber', title: '发动机号'}
                                                , {field: 'origin', title: '取得方式'}
                                                , {field: 'useDirection', title: '使用方向'}
                                                , {field: 'usage', title: '使用状况'}
                                                , {field: 'useDep', title: '使用部门'}
                                                , {field: 'responsibleDep', title: '管理部门'}
                                                , {field: 'usePersonnel', title: '使用人'}
                                                , {field: 'amount', title: '数量'}
                                                , {field: 'preparedBy', title: '制单人'}
                                                , {field: 'affiliatedUnit', title: '所属单位'}
                                                , {field: 'model', title: '规格型号'}
                                                , {field: 'place', title: '存放地点'}
                                                , {field: 'originalAssetNumber', title: '原资产编号'}
                                                , {field: 'displacement', title: '排气量'}
                                                , {field: 'brand', title: '品牌'}
                                                , {field: 'voucherID', title: '凭证号ID'}
                                                , {field: 'idleValue', title: '闲置价值'}
                                                , {field: 'reserve', title: '备用字段'}
                                                , {field: 'warranty', title: '报废日期'}
                                                , {field: 'limitCount', title: '下限阈值'}
                                                , {field: 'equipmentUsage', title: '设备用途'}
                                                , {field: 'manufacturer', title: '生产厂家'}
                                                , {field: 'invoiceNumber', title: '发票号'}
                                                , {field: 'seller', title: '销售商'}
                                                , {field: 'accountingVoucherNumber', title: '会计凭证号'}
                                                , {field: 'lendingValue', title: '出借价值'}
                                                , {field: 'rentalValue', title: '出租价值'}
                                                , {field: 'investmentAbroad', title: '对外投资价值'}
                                                , {field: 'guaranteeValue', title: '担保价值'}
                                                , {field: 'otherValues', title: '其他价值'}
                                                , {field: 'evaluationValue', title: '评估价值'}
                                                , {field: 'confirmValue', title: '确认价值'}
                                                , {field: 'initialSelfUseValue', title: '初始自用价值'}
                                                , {field: 'initialRentalValue', title: '初始出租价值'}
                                                , {field: 'initialLendingValue', title: '初始出借价值'}
                                                , {field: 'initialInvestmentAbroad', title: '初始对外投资价值'}
                                                , {field: 'initialGuaranteeValue', title: '初始担保价值'}
                                                , {field: 'initialOtherValue', title: '初始其他价值'}
                                                , {field: 'internalBusinessValue', title: '内部经营价值'}
                                                , {field: 'procurementOrganization', title: '采购组织形式'}
                                                , {field: 'remarks', title: '备注'}
                                            ]]
                                            , height: 'full-230',
                                            toolbar: '#importlistDemo',
                                            defaultToolbar: ['filter']
                                            , data: res.data
                                            , page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                                                layout: ['prev', 'page', 'next', 'skip', 'count', 'limit']//自定义分页布局
                                                //,curr: 5 //设定初始在第 5 页
                                                , groups: 5//只显示 1 个连续页码
                                                , curr: 1
                                                , limit: 10
                                                , limits: [10, 15, 20]
                                            },
                                        });

                                    },
                                    end: function () {
                                        var correctsuccesses = $("#correctsuccesses").val();
                                        if (correctsuccesses == "1") {

                                        } else {
                                            layui.table.reload('product');
                                        }
                                        return false;
                                    }
                                });
                            } else {
                                layui.layer.msg('导入数据模板格式错误');
                            }
                        }, 1000);
                    }
                }, error: function (index, upload) { //请求异常回调
                    layui.layer.close(sss);
                    //layui.layer.msg('服务器网络异常或其他异常');
                }
            });
        }

        //监听头工具栏事件
        table.on('toolbar(importlists)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
                , data = checkStatus.data;//获取选中的数据
            switch (obj.event) {
                case 'check':
                    check();
                    break;
                case 'importdatas':
                    importdatas();
                    break;
            }
            ;
        });


        function check() {
            var dataArray = $("#datas").val();
            var sss = JSON.parse(dataArray);
            if (sss.data.length == 0) {
                layui.layer.msg("当前表格没有数据");
                return;
            } else {
                layui.layer.load("loading");//上传loading
                setTimeout(function () {
                    var param = {"dataArray": dataArray};
                    $.ajax({
                        type: "post",
                        url: "<%=request.getContextPath()%>/rest/reporting/importExcelVerification",
                        data: JSON.stringify(param),
                        dataType: "json",
                        contentType: "application/json;charset=utf-8",
                        async: false,
                        success: function (data) {
                            $("#error").html("错误：" + data.error.length + " 条数据")
                            $("#correct").html("正确：" + data.correct.length + " 条数据");
                            $("#correctlenght").val(data.correct.length);
                            $("#correctyyyyy").html("资产编号共" + data.yyy.length + "条数据一样");
                            $("#yyy").val(data.yyy.length);
                            var jsArr = JSON.stringify(data);
                            $("#correctdata").val(jsArr);
                            layui.layer.closeAll('loading');
                            layui.table.reload('importlist');
                            layui.table.render({
                                elem: '#importlist'
                                , cols: [[
                                    {field: 'checkresult', title: '校验', width: 70, fixed: "left"},
                                    {field: 'number', title: 'ID', width: 70, sort: true, fixed: "left"}
                                    , {field: 'assetNumber', title: '资产编号', fixed: "left"}
                                    , {field: 'auditStatus', title: '审核状态'}
                                    , {field: 'preparationTime', title: '制单时间'}
                                    , {field: 'auditOpinion', title: '审核意见'}
                                    , {field: 'category', title: '资产大类'}
                                    , {field: 'classify', title: '资产分类'}
                                    , {field: 'name', title: '物资名称'}
                                    , {field: 'accountSet', title: '帐套'}
                                    , {field: 'putIntoUseDate', title: '投入使用日期'}
                                    , {field: 'buildDate', title: '取得日期'}
                                    , {field: 'selfUseValue', title: '自用价值'}
                                    , {field: 'depreciationStatus', title: '折旧状态'}
                                    , {field: 'depreciationMonths', title: '已提折旧月数'}
                                    , {field: 'depreciationAccumulated', title: '累计折旧'}
                                    , {field: 'serviceLife', title: '使用年限（月）'}
                                    , {field: 'entryDate', title: '财务入账日期'}
                                    , {field: 'valueType', title: '价值类型'}
                                    , {field: 'value', title: '价值'}
                                    , {field: 'financialFunds', title: '财政性资金'}
                                    , {field: 'nonFinancialFunds', title: '非财政性资金'}
                                    , {field: 'netWorth', title: '净值'}
                                    , {field: 'carNumber', title: '车牌号'}
                                    , {field: 'engineNumber', title: '发动机号'}
                                    , {field: 'origin', title: '取得方式'}
                                    , {field: 'useDirection', title: '使用方向'}
                                    , {field: 'usage', title: '使用状况'}
                                    , {field: 'useDep', title: '使用部门'}
                                    , {field: 'responsibleDep', title: '管理部门'}
                                    , {field: 'usePersonnel', title: '使用人'}
                                    , {field: 'amount', title: '数量'}
                                    , {field: 'preparedBy', title: '制单人'}
                                    , {field: 'affiliatedUnit', title: '所属单位'}
                                    , {field: 'model', title: '规格型号'}
                                    , {field: 'place', title: '存放地点'}
                                    , {field: 'originalAssetNumber', title: '原资产编号'}
                                    , {field: 'displacement', title: '排气量'}
                                    , {field: 'brand', title: '品牌'}
                                    , {field: 'voucherID', title: '凭证号ID'}
                                    , {field: 'idleValue', title: '闲置价值'}
                                    , {field: 'reserve', title: '备用字段'}
                                    , {field: 'warranty', title: '报废日期'}
                                    , {field: 'limitCount', title: '下限阈值'}
                                    , {field: 'equipmentUsage', title: '设备用途'}
                                    , {field: 'manufacturer', title: '生产厂家'}
                                    , {field: 'invoiceNumber', title: '发票号'}
                                    , {field: 'seller', title: '销售商'}
                                    , {field: 'accountingVoucherNumber', title: '会计凭证号'}
                                    , {field: 'lendingValue', title: '出借价值'}
                                    , {field: 'rentalValue', title: '出租价值'}
                                    , {field: 'investmentAbroad', title: '对外投资价值'}
                                    , {field: 'guaranteeValue', title: '担保价值'}
                                    , {field: 'otherValues', title: '其他价值'}
                                    , {field: 'evaluationValue', title: '评估价值'}
                                    , {field: 'confirmValue', title: '确认价值'}
                                    , {field: 'initialSelfUseValue', title: '初始自用价值'}
                                    , {field: 'initialRentalValue', title: '初始出租价值'}
                                    , {field: 'initialLendingValue', title: '初始出借价值'}
                                    , {field: 'initialInvestmentAbroad', title: '初始对外投资价值'}
                                    , {field: 'initialGuaranteeValue', title: '初始担保价值'}
                                    , {field: 'initialOtherValue', title: '初始其他价值'}
                                    , {field: 'internalBusinessValue', title: '内部经营价值'}
                                    , {field: 'procurementOrganization', title: '采购组织形式'}
                                    , {field: 'remarks', title: '备注'}
                                    , {field: 'error', title: '理由', width: 200, fixed: "right"}
                                ]]
                                , height: 'full-230',
                                toolbar: '#importlistDemos'
                                , cellMinWidth: 200,
                                defaultToolbar: ['filter']
                                , data: data.error
                                , page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                                    layout: ['prev', 'page', 'next', 'skip', 'count', 'limit']//自定义分页布局
                                    //,curr: 5 //设定初始在第 5 页
                                    , groups: 5//只显示 1 个连续页码
                                    , curr: 1
                                    , limit: 10
                                    , limits: [10, 15, 20]
                                },
                            });
                        }
                    })
                }, 2000);

            }
        }


        function importdatas() {
            var correctlenght = $("#correctlenght").val();
            var yyy = $("#yyy").val();
            if (yyy == 0) {
                if (correctlenght == 0) {
                    layui.layer.msg("数据校验全部错误");
                    return;
                } else {
                    layer.confirm('确定是否导入数据', {icon: 3, title: '提示信息', shade: 0.6}, function (index) {
                        layer.close(index);
                        var sss = layui.layer.load(1);
                        setTimeout(function () {
                            var correctdata = $("#correctdata").val();
                            var param = {"correctdata": correctdata};
                            $.ajax({
                                type: "post",
                                url: "<%=request.getContextPath()%>/rest/reporting/importExcelCorrect",
                                data: JSON.stringify(param),
                                dataType: "json",
                                contentType: "application/json;charset=utf-8",
                                async: false,
                                success: function (data) {
                                    layui.layer.close(sss);
                                    layui.layer.msg('导入成功', {
                                        time: 3000 //2秒关闭（如果不配置，默认是3秒）
                                    })
                                    $("#correctsuccesses").val("2");
                                    $('#importdatas').hide();
                                }
                            })
                        }, 2000);
                    })
                }
            } else {
                layer.confirm('资产编号已存在,确定是否改变所属单位', {
                    icon: 3, title: '提示信息', shade: 0.6,
                    btn: ['确认', '取消'],
                }, function (index) {
                    layer.close(index);
                    var pppp = layui.layer.load(1);
                    setTimeout(function () {
                        var correctdata = $("#correctdata").val();
                        var params = {"correctdata": correctdata};
                        $.ajax({
                            type: "post",
                            url: "<%=request.getContextPath()%>/rest/reporting/importsdssss",
                            data: JSON.stringify(params),
                            dataType: "json",
                            contentType: "application/json;charset=utf-8",
                            async: false,
                            success: function (data) {
                                layui.layer.close(pppp);
                                layui.layer.msg("修改成功");
                            }
                        })
                    }, 2000);
                    setTimeout(function () {
                        if (correctlenght == 0) {
                            layui.layer.msg("数据校验全部错误");
                            return;
                        } else {
                            layer.confirm('确定是否导入数据', {icon: 3, title: '提示信息', shade: 0.6}, function (index) {
                                layer.close(index);
                                var sss = layui.layer.load(1);
                                setTimeout(function () {
                                    var correctdata = $("#correctdata").val();
                                    var param = {"correctdata": correctdata};
                                    $.ajax({
                                        type: "post",
                                        url: "<%=request.getContextPath()%>/rest/reporting/importExcelCorrect",
                                        data: JSON.stringify(param),
                                        dataType: "json",
                                        contentType: "application/json;charset=utf-8",
                                        async: false,
                                        success: function (data) {
                                            layui.layer.close(sss);
                                            layui.layer.msg('导入成功', {
                                                time: 3000 //2秒关闭（如果不配置，默认是3秒）
                                            })
                                            $("#correctsuccesses").val("2");
                                            $('#importdatas').hide();
                                        }
                                    })
                                }, 2000);
                            })
                        }
                        return;
                    }, 4000);
                }, function (index) {
                    layer.close(index);
                    setTimeout(function () {
                        if (correctlenght == 0) {
                            layui.layer.msg("数据校验全部错误");
                            return;
                        } else {
                            layer.confirm('确定是否导入数据', {icon: 3, title: '提示信息', shade: 0.6}, function (index) {
                                layer.close(index);
                                var sss = layui.layer.load(1);
                                setTimeout(function () {
                                    var correctdata = $("#correctdata").val();
                                    var param = {"correctdata": correctdata};
                                    $.ajax({
                                        type: "post",
                                        url: "<%=request.getContextPath()%>/rest/reporting/importExcelCorrect",
                                        data: JSON.stringify(param),
                                        dataType: "json",
                                        contentType: "application/json;charset=utf-8",
                                        async: false,
                                        success: function (data) {
                                            layui.layer.close(sss);
                                            layui.layer.msg('导入成功', {
                                                time: 3000 //2秒关闭（如果不配置，默认是3秒）
                                            })
                                            $("#correctsuccesses").val("2");
                                            $('#importdatas').hide();
                                        }
                                    })
                                }, 2000);
                            })
                        }
                    }, 2000);
                    return;
                })
            }
        }


    });


</script>
</body>
</html>
